<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>Rainbond Static Demo</title>

    <meta
            name="description"
            content="Rainbond（云帮）是一款以应用为中心的开源PaaS，深度整合基于Kubernetes的容器管理、Service Mesh微服务架构最佳实践、多类型CI/CD应用构建与交付、多数据中心资源管理等技术，为用户提供云原生应用全生命周期解决方案，构建应用与基础设施、应用与应用、基础设施与基础设施之间互联互通的生态体系，满足支撑业务高速发展所需的敏捷开发、高效运维和精益管理需求。"
    />

    <meta name="author" content="goodrain"/>

    <meta property="og:title" content="Rainbond java Demo"/>
    <meta
            property="og:description"
            content="Rainbond（云帮）是一款以应用为中心的开源PaaS，深度整合基于Kubernetes的容器管理、Service Mesh微服务架构最佳实践、多类型CI/CD应用构建与交付、多数据中心资源管理等技术，为用户提供云原生应用全生命周期解决方案，构建应用与基础设施、应用与应用、基础设施与基础设施之间互联互通的生态体系，满足支撑业务高速发展所需的敏捷开发、高效运维和精益管理需求。"
    />
    <meta property="og:type" content="website"/>
    <meta property="og:url" content="/"/>
    <meta property="og:updated_time" content="2017-03-02T21:56:55&#43;01:00"/>
    <link rel="canonical" href="/"/>

    <link href="./static/css/font.css" rel="stylesheet" type="text/css"/>
    <link href="./static/css/kube.min.css" rel="stylesheet" type="text/css"/>
    <link
            href="./static/css/kube.legenda.css"
            rel="stylesheet"
            type="text/css"
    />
    <link href="./static/css/highlight.css" rel="stylesheet" type="text/css"/>
    <link href="./static/css/master.css" rel="stylesheet" type="text/css"/>
    <link href="./static/css/kube.demo.css" rel="stylesheet" type="text/css"/>
    <link href="./static/css/bootstrap.min.css" rel="stylesheet">
    <link href="./static/css/custom.css" rel="stylesheet" type="text/css"/>
</head>

<body class="page-kube">
<header>
    <div class="show-sm">
        <div id="nav-toggle-box">
            <div id="nav-toggle-brand">
                <a href="/" target="_blank">Rainbond</a>
            </div>
            <a
                    data-component="toggleme"
                    data-target="#top"
                    href="#"
                    id="nav-toggle"
            ><i class="kube-menu"></i
            ></a>
        </div>
    </div>
    <div class="hide-sm" id="top">
        <div id="top-brand">
            <a href="/" target="_blank" title="home">Rainbond</a>
        </div>
        <nav id="top-nav-main">
            <ul>
                <li>
                    <a href="https://github.com/goodrain/rainbond" target="_blank"
                    >Github</a
                    >
                </li>

                <li>
                    <a
                            href="https://www.rainbond.com/docs/stable/user-manual/app-creation/language-support/html.html"
                            target="_blank"
                    >Docs</a
                    >
                </li>
                <li>
                    <a
                            href="./mysql.html"
                            target="_blank"
                    >Mysql 示例</a
                    >
                <li>
                    <a
                            href="./apiInstance.html"
                            target="_blank"
                    >API 示例</a
                    >
                </li>
            </ul>
        </nav>
        <nav id="top-nav-extra">
            <ul>
                <li>
                    <a href="https://console.goodrain.com" target="_blank"
                    >试用公有云</a
                    >
                </li>
            </ul>
        </nav>
    </div>
</header>

<main>
    <div class="container">
        <div>
            <label>MySQL连接信息</label>
            <table id="db_info" class="table table-bordered table-hover " style="width: 700px">

            </table>
        </div>

        <div class="alert  alert-danger" role="alert" id="noShow" style="display: none">连接数据库失败,请重试.</div>

        <div id="tables"  style="display: none;">
            <label>所有的表</label>
            <table class="table table-bordered table-hover " style="width: 700px">
                <thead>
                <tr>
                    <th style="width:200px">序号</th>
                    <th style="width:500px">表名</th>
                </tr>
                </thead>
                <tbody id="t_body">

                </tbody>
            </table>
        </div>
    </div>
</main>
<footer>
    <footer id="footer">
        <nav>
            <ul>
                <li><span>Rainbond</span></li>
            </ul>
        </nav>
        <p>&copy; Licence Apache.</p>
    </footer>
</footer>
<script src="./static/js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script type="text/javascript" src="./static/js/tocbot.min.js"></script>
<script src="./static/js/kube.js" type="text/javascript"></script>
<script src="./static/js/master.js" type="text/javascript"></script>
</body>
</html>

<script>
    $.ajax({
        type: "get",
        async: true,
        url: "/foobar/db-info",
        dataType: "json",
        success: function (res) {
            if (res.success === 0) {
                var str = "";
                str +=
                    "<tr>" +
                    "<td style=\"width:200px\">MYSQL_HOST</td>" +
                    "<td style=\"width:500px\">" + res.data.MYSQL_HOST + "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td>MYSQL_PORT</td>" +
                    "<td>" + res.data.MYSQL_PORT + "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td>MYSQL_USER</td>" +
                    "<td>" + res.data.MYSQL_USER + "</td>" +
                    "</tr>" +
                    "<tr>" +
                    "<td>MYSQL_PASSWORD</td>" +
                    "<td>" + res.data.MYSQL_PASSWORD + "</td>" +
                    "</tr>" +
                    "<td>MYSQL_DATABASE</td>" +
                    "<td>" + res.data.MYSQL_DATABASE + "</td>" +
                    "</tr>";
                $("#db_info").append(str);
            }
        },
        error: function (res) {
        }
    });

    $.ajax({
        type: "get",
        async: true,
        url: "/dbinfo/ping",
        dataType: "json",
        success: function (res) {
            if (res.data) {
                $.ajax({
                    type: "get",
                    async: true,
                    url: "/dbinfo/list-tables",
                    dataType: "json",
                    success: function (data) {
                        var str = "";
                        for (var i = 0; i < data.data.length; i++) {
                            str += "<tr>" +
                                "<td>" + i + "</td>" +
                                "<td>" + data.data[i] + "</td>" +
                                "</tr>";
                        }
                        $("#t_body").append(str);

                        $("#noShow").css("display", "none")
                        $("#tables").css("display", "block");

                    },
                    error: function (data) {
                        console.log(data)
                    }
                });
            } else {
                $("#noShow").css("display", "block")
            }
        },
        error: function (data) {
            console.log(data)
        }
    });

</script>